package com.gengzp.permission.core;

import com.gengzp.permission.exception.PermissionException;
import com.gengzp.permission.model.UserPrincipalModel;
import jakarta.servlet.http.HttpServletRequest;

/**
 * @ClassName PermissionTokenValidator
 * @Description 权限认证框架token处理器接口
 * <p> 可通过实现该接口来自定义token的获取和解析逻辑, 若未实现则使用默认实现类
 * <p> 默认实现类为 PermissionTokenProcessorImplDefault
 * {@link com.gengzp.permission.core.impl.PermissionTokenProcessorImplDefault}
 * @Author gengzp
 * @Date 2025/8/15 13:41
 */
public interface PermissionTokenProcessor {

    /**
     * 解析并校验请求中携带的认证信息
     *
     * @param request 请求信息
     * @param handler 处理器信息
     * @return token
     */
    UserPrincipalModel parseAndVerifyRequestAuthentication(HttpServletRequest request, Object handler) throws PermissionException;

}
